﻿using System;

namespace INHollandair.Core.Models
{
    public static class RngUtils
    {
        public static string GetUrlString()
        {
            string urlString = EncryptionUtils.Salt();
            urlString = urlString.Replace("+", (GetRandomNumberAsString(1)));
            urlString = urlString.Replace("=", (GetRandomNumberAsString(1)));
            urlString = urlString.Replace("/", (GetRandomNumberAsString(1)));

            return urlString;
        }

        public static string GetRandomNumberAsString(int length)
        {
            if (!(length > 0 && length < 10))
            {
                length = 6;
            }

            Random random = new Random();
            string s = "";
            for (int i = 0; i < length; i++)
                s = String.Concat(s, random.Next(10).ToString());
            return s;
        }
    }
}
